package cn.didi.feidi.androidorder.assembly;

import android.app.Dialog;
import android.databinding.DataBindingUtil;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;

import cn.didi.feidi.androidorder.R;
import cn.didi.feidi.androidorder.databinding.DialogConfirmDepositInfoBinding;
import cn.didi.feidi.androidorder.model.OrderUsFi;

/**
 * Created by jinxiong on 2017/8/30.
 */

public class ConfirmDepositInfoFragmentDialog extends BaseDialogFragment {

    DialogConfirmDepositInfoBinding binding;
    View.OnClickListener payListener;
    OrderUsFi mOrderUsFi;

    public void setPayListener(View.OnClickListener payListener) {
        this.payListener = payListener;
    }


    public void setOrderUsFi(OrderUsFi orderUsFi) {
        this.mOrderUsFi = orderUsFi;
    }

    @NonNull
    @Override
    protected Dialog newDialog() {

        Dialog dialog = new Dialog(getActivity(), R.style.style_dialog);
        dialog.setCanceledOnTouchOutside(false);
        setRightPadding(0).setLeftPadding(0).setDialogGravity(Gravity.BOTTOM);

        binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.dialog_confirm_deposit_info,
                (ViewGroup) getActivity().getWindow().getDecorView(), false);
        dialog.setContentView(binding.getRoot());
        return dialog;
    }

    @Override
    protected void addListener() {

        binding.confirmDepositPayTv.setOnClickListener(payListener);

        binding.confirmDepositCancelTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

        binding.dialogConfirmDepositCloseFl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

    }


    @Override
    protected void initView() {

        if (mOrderUsFi != null) {
            binding.setOrderUsFi(mOrderUsFi);
        }
    }
}
